<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    
<%@page import="sqlClass.daoClass.*"%>
<%@page import="general.dbClass.*"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.sql.Connection" %>
<%@page import="java.sql.DriverManager" %>


<%
	String 		user 	= "mmpr_ws11_a"; 
	String 		password = "Ateam2011";
	String 		database = "10.0.107.20:1521:GBIR";

	Connection 	con = null;
	
	con = (Connection) session.getAttribute("conn");
	if (con == null) {
		try {
			DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
			con = DriverManager.getConnection ("jdbc:oracle:thin:@"+database, user, password);
	    	con.setAutoCommit(false);
	    }
		catch(Exception sqle) {
			String message = sqle.getMessage();
			request.setAttribute("Quelle", "connect");
			request.setAttribute("Error", message);
			String url = response.encodeURL("/errorInfo.jsp");
			RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
			dispatcher.forward(request,response);
		} 
		session.setAttribute("conn", con);
	}
	else {
		con = (Connection) session.getAttribute("conn");
	}
%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta content="de" http-equiv="Content-Language">
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>fotoDB</title>
	<link  type="text/css" rel="stylesheet" href="styles/style.css" />
	<link  type="text/css" rel="stylesheet" href="styles/styleRating.css"/>
	<link  type="text/css" rel="stylesheet" href="styles/styleButton.css"/>
	<!-- <link  type="text/css" rel="stylesheet" href="styles/style_old.css" /> -->
</head>
<body>
	<div id="header">
		<div id="navi">
			<div class="links">
				<a href="index.jsp">Home</a>
			</div>
			<div class="links">
				<a href="SearchApp?searchFor=categories">Kategorie</a>
			</div>
			<div class="links">
				<a href="SearchApp?searchFor=thumbs&in=all">Galerie</a>
			</div>
			<div class="links">
				<c:if test="${sessionScope.usr!=null}">
				<a href="SearchApp?searchFor=allCategorieAndKeyword">Upload</a>
				</c:if>
			</div>
		</div>
		<div class="space"></div>
		
		<c:if test="${sessionScope.usr!=null}">
		<form action="LogoutApp">
		<div id="logout">
			Willkommen,Benutzer
			<input type="submit" value="Abmelden">
		</div>
		</form>
		</c:if>
		
		<c:if test="${sessionScope.usr==null}">
		<form action="LoginApp">
		<div id="login">
			Name:
			<input type="text" name="name" size="15">
			Passwort:
			<input type="password" name="pass" size="15">
			<input type="submit" value="Anmelden">
		</div>
		</form>
		</c:if>
		
		<div id="search">
			<div id="logo">
				<img alt="" src="images/logo3.png">
			</div>
			<div id="search_input">
			<form name="searchform" method="post" action="SearchApp?searchFor=thumbs&in=keyword" >
				<div><input style="float: left;" name="keyword" class="searchform" onclick="this.value=''" type="text" value="Bild suchen..." size="50" 
						onFocus="if (this.value=='Bild suchen...') this.value='';" onblur="if (this.value=='') this.value=this.defaultValue;" 
						onKeyDown="if (event.keyCode==13)form.submit()">&nbsp;</div>
				<div><input style="margin-left:10px;" type="image" src="images/search.png" alt="suchen" /></input>&nbsp;</div>
			</form>
			</div>
		</div>
	</div>